package lab04.test06;

import javax.script.Compilable;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by HASEE on 2017/12/21.
 */
public class Test {


    public static void main(String[] args) {
        Map<String,Integer> map=new HashMap<>();
        BufferedReader reader=null;


        try {
            reader=new BufferedReader(new FileReader("C:\\key.txt"));
            String stuNo=null;
            try {
                while((stuNo=reader.readLine())!=null){
                    map.put(stuNo,0);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }


        finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        File files=new File("C：\\16信本2班Java作业一");
        File[] files =files.listFiles();

        for (File f:files){
            String fileName=f.getName();


            Matcher matcher= Pattern.compile("信本2班（\\d+）").matcher(fileName);
            while(matcher.find()){
                String no = matcher.group(1);
            }
            String no;
            map.put(no,1);
        }
        //打印没交的学号
        for (Map.Entry<String,Integer>entry:map.entrySet()){
            if (entry.getValue()==0){
                System.out.println(entry.getValue());
            }
        }
    }
}
